package com.gko100.action.authority;

import com.gko100.model.Administrator;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AdminAuthorityInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4621954022678918701L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		
		
		ActionContext ctx = ActionContext.getContext();
		Administrator admin = (Administrator)ctx.getSession().get("admin");
		String signState = admin.getSignState();
		//String methodName = invocation.getProxy().getMethod();
		//System.out.println("拦截器------------当前运行的方法名--------"+methodName);
		
		
		if (signState != null && (signState.equals("login")))
		{
			return invocation.invoke();
		}else
		{
			return Action.LOGIN;
		}
		
		
		
		
	}

}
